#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#include <error.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <openssl/rand.h>

//gcc rand.c -lssl -lcrypto

int main(int argc,char *argv[])
{
    int ret;
    unsigned char aes_ivec[16];
    unsigned char aes_key[16];

    ret = RAND_bytes(aes_ivec,sizeof(aes_ivec));
    if(ret != 1)
    {
        printf("RAND_bytes error..\r\n");
        return -1;
    }
    printf("aes_ivec:\r\n");
    for(int32_t i = 0;i < sizeof(aes_ivec);i++)
    {
        if(i && (!(i % 8)))
        {
            printf("\r\n");
        }
        printf("%02x ",aes_ivec[i]);
    }
    printf("\r\n");

    return 0;
}